package com.info.zhiduoduo.admin.controller;

import com.info.zhiduoduo.admin.service.BalanceService;
import com.info.zhiduoduo.common.constants.SmartResult;
import com.info.zhiduoduo.common.formbean.BaseSimpleFormBean;

import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * Created by TerryJ on 2018/11/22
 */
@RestController
@RequestMapping("/demo")
public class DemoController extends CommonController{

    @Resource
    BalanceService balanceService;

    @RequestMapping(value="/test")
    public String test() throws Exception {
        return "run demo";
    }

    @PostMapping("/testPay")
    public SmartResult testpay(@RequestBody BaseSimpleFormBean formBean) {
        return new RestTemplate().postForObject("http://localhost:8866/pay/test", formBean, SmartResult.class);
    }

    @GetMapping("/queryBalance")
    public void queryBalance(){
        balanceService.queryBalanceAndNotice(1);
    }

}